package scheduler

import "gitee.com/wuzp__dev/crawler/crawler/engine"

type SimpleScheduler struct {
	workerChan chan engine.Request
}

func (s *SimpleScheduler) WorkerChan() chan engine.Request {
	return s.workerChan
}

func (s *SimpleScheduler) WorkerReady(w chan engine.Request) {

}

func (s *SimpleScheduler) Run() {
	s.workerChan = make(chan engine.Request)
}

func (s *SimpleScheduler) Submit(r engine.Request) {
	// s.workerChan <- r // 这里会导致循环等待，worker从request取数据，而request又要从worker中获得ParseResult
	go func() { s.workerChan <- r }()
}
